package com.itheima.reggie.common;
/**
 * @author Administrator
 * @date 2023/5/18 9:21
 */

/**
 * 封装工具,获取和设置用户id
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal=new ThreadLocal<Long>();

    /**
     * 设置id
     * @param id
     */
    public static void setId(Long id){
        threadLocal.set(id);
    }

    /**
     * 获取id
     * @return
     */
    public static Long getId(){
       return threadLocal.get();
    }
}
